home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_tutor.arc / SOURCE.ARC / TEMPCONV.C < prev    next >
C/C++ Source or Header  |  1990-08-08  |  1KB  |  31 lines

  1.                                        /* Chapter 3 - Program 8 */
  2. /****************************************************************/
  3. /*                                                              */
  4. /*     This is a temperature conversion program written in      */
  5. /*      the C programming language. This program generates      */
  6. /*      and displays a table of farenheit and centigrade        */
  7. /*      temperatures, and lists the freezing and boiling        */
  8. /*      of water.                                               */
  9. /*                                                              */
  10. /****************************************************************/
  11.  
  12. main()
  13. {
  14. int count;        /* a loop control variable               */
  15. int farenheit;    /* the temperature in farenheit degrees  */
  16. int centigrade;   /* the temperature in centigrade degrees */
  17.  
  18.    printf("Centigrade to Farenheit temperature table\n\n");
  19.  
  20.    for(count = -2;count <= 12;count = count + 1){
  21.       centigrade = 10 * count;
  22.       farenheit = 32 + (centigrade * 9)/5;
  23.       printf("  C =%4d   F =%4d  ",centigrade,farenheit);
  24.       if (centigrade == 0)
  25.          printf(" Freezing point of water");
  26.       if (centigrade == 100)
  27.          printf(" Boiling point of water");
  28.       printf("\n");
  29.    } /* end of for loop */
  30. }
  31.